package com.ithinkstudio.jeez.generator.config;

import com.ithinkstudio.jeez.config.YamlPropertySourceFactory;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@PropertySource(value={"classpath:generatorConfig.yml"}, factory = YamlPropertySourceFactory.class)
@ConfigurationProperties(prefix = "generate")
@Data
@Accessors(chain = true)
public class GenerateConfig {

    /**
     * 使用的数据库 mysql/oracle/postgresql
     */
    private String db;

    /**
     * 数据库驱动类
     */
    private String driverClassName;
    /**
     * jdbc连接URL
     */
    private String url;
    /**
     * 数据库用户名
     */
    private String username;
    /**
     * 数据库密码
     */
    private String password;

    /**
     * 数据库schema  mysql必填
     */
    private String schema;

    /**
     * 要生成的表名
     */
    private List<String> tableNames;
    /**
     * mybatis配置
     */
    private MybatisConfig mybatis = new MybatisConfig();
    /**
     * JPA配置
     */
    private JpaConfig jpa = new JpaConfig();
    /**
     * 实体类配置
     */
    private ModelConfig model = new ModelConfig();
    /**
     * 服务接口配置
     */
    private ServiceConfig service = new ServiceConfig();
    /**
     * 服务实现类配置
     */
    private ServiceImplConfig serviceImpl = new ServiceImplConfig();
    /**
     * 全局配置
     */
    private GlobalConfig globalConfig = new GlobalConfig();
}
